<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });

// 静态资源路由
// 首页
Route::get('/','StaticPagesController@home')->name('home');
// 帮助页
Route::get('/help', 'StaticPagesController@help')->name('help');
// 关于
Route::get('/about', 'StaticPagesController@about')->name('about');

/*
    用户路由
    GET     /users              UsersController@index   显示所有用户列表的页面
    GET     /users/{user}       UsersController@show    显示用户个人信息的页面
    GET     /users/create       UsersController@create  创建用户的页面
    POST    /users              UsersController@store   创建用户
    GET     /users/{user}/edit  UsersController@edit    编辑用户个人资料的页面
    PATCH   /users/{user}       UsersController@update  更新用户
    DELETE  /users/{user}       UsersController@destroy 删除用户
*/
Route::resource('/users','UsersController');

// 会话路由
// 登录页面
Route::get('login', 'SessionsController@create')->name('login');
// 登录页面 信息处理
Route::post('login', 'SessionsController@store')->name('login');
// 退出登录
Route::delete('logout', 'SessionsController@destroy')->name('logout');

// 激活路由
Route::get('signup/confirm/{token}', 'UsersController@confirmEmail')->name('confirm_email');

// 密码重置相关路由
// 显示重置密码的邮箱发送页面
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
// 邮箱发送重设链接
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
// 密码更新页面
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
// 执行密码更新操作
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

// 博客创建 删除
Route::resource('statuses', 'StatusesController', ['only' => ['store', 'destroy']]);

// 用户关注人列表
Route::get('/users/{user}/followings', 'UsersController@followings')->name('users.followings');
// 用户粉丝列表
Route::get('/users/{user}/followers', 'UsersController@followers')->name('users.followers');

// 关注用户
Route::post('/users/followers/{user}', 'FollowersController@store')->name('followers.store');
// 取消关注用户
Route::delete('/users/followers/{user}', 'FollowersController@destroy')->name('followers.destroy');